home *** CD-ROM | disk | FTP | other *** search
/ Windows Surprise 3 / Windows Surprise 3.iso / defen.140 / custom / demo.h < prev    next >
C/C++ Source or Header  |  1995-05-25  |  2KB  |  110 lines

  1. // demo.h
  2.  
  3. #ifndef _demo_h
  4. #define _demo_h
  5.  
  6. // user this structure to pass information to the main program
  7. struct DemoInfo
  8. {
  9.     char *Target;
  10.     int Version;
  11.     char *DemoName;
  12.     char *HiScoreEntry;
  13. };
  14.  
  15. // receive information on game objects in this structure
  16. struct GameObject
  17. {
  18.     int Flags,Type,User;
  19.     int x,y,w,h;
  20.     long xv,yv;
  21.     BOOL Valid;
  22. };
  23.  
  24. // receive other information in these structures and pass back controls
  25. union Controls
  26. {
  27.     BYTE byte;
  28.     struct BITS
  29.     {
  30.         BYTE Up:1;
  31.         BYTE Down:1;
  32.         BYTE Thrust:1;
  33.         BYTE Dir:1;
  34.         BYTE Fire:1;
  35.         BYTE Smart:1;
  36.         BYTE Hyperspace:1;
  37.     } bits;
  38. };
  39.  
  40.  
  41. struct GameInfo
  42. {
  43.     int Lives,SmartBombs;
  44.     DWORD Score,Frame;
  45.     BYTE *Landscape;
  46.     BOOL Scape;
  47.     GameObject Ship;
  48.  
  49.     Controls *C;
  50.     };
  51.  
  52. typedef void (CALLBACK *DemoProc)(GameObject *);
  53.  
  54. extern "C" // prevent name mangling
  55. {
  56.     DemoInfo * _export CALLBACK Initialize(DemoProc F,DemoProc N);
  57.     void _export CALLBACK ControlDemo(GameInfo*);
  58.     void _export CALLBACK GameInit();
  59.     void _export CALLBACK GameOver(DWORD,WORD);
  60. }
  61.  
  62. // game object type in GameObject.Type
  63. #ifndef _OBJECTS
  64. enum {SHIP1=0,HUMANOID,LANDER,MUTANT,PULSAR,POD,PODBIT,BAITER,
  65.     LASER,BULLET,PULSBUL};
  66. #define _OBJECTS
  67. #endif
  68.  
  69. // general macros ***************************
  70.  
  71. // planet size
  72. #define PSIZE 4096
  73. // mask for planet size
  74. #define XMASK 0xfff
  75. // xv,yv are stores as pixels per frame << LSH
  76. #define LSH 20
  77.  
  78. // get signed integer x-coordinate value
  79. #ifdef WIN32
  80.     #define SIGNX(x) (((int)(x)<<LSH)>>LSH)
  81. #else
  82.     #define SIGNX(x) (((int)(x)<<(LSH-16))>>(LSH-16))
  83. #endif
  84.  
  85. // test if -r<x<r
  86. #define INRANGE(x,r) ((WORD) ( (x) +r)<2*r)
  87.  
  88.  
  89. // object flags in GameObject.Flags
  90. #define O_DEAD 1
  91. #define O_MATERIALISE 2
  92. #define O_SMALLWEAP 4
  93. #define O_EXPL 8
  94. #define O_SHIP 16
  95.  
  96. // humanoid states in GameObject.User when Type==HUMANOID
  97. #define H_NORM 0
  98. #define H_HELD 1
  99. #define H_FALLING 2
  100.  
  101. // lander states in GameObject.User when Type==LANDER
  102. #define L_NORM 0
  103. #define L_GRABBING 1
  104. #define L_LIFTING 2
  105.  
  106. // Demo mode interface version
  107. #define VERSION 0x100
  108.  
  109. #endif
  110.